<template>
  <div id="mainContainer">
    <div id="top">
      <el-link id="logo" :underline="false" @click="toIndex">ELM后台管理系统</el-link>
      <div id="info">
        <span>欢迎【{{ this.userName }}】登陆</span>
        <el-link type="danger" @click="exit">退出</el-link>
      </div>
    </div>
    <div id="center">
      <div id="left">
        <el-menu background-color="transparent" router :default-openeds="['1']">
<!--          用户信息维护-->
          <el-sub-menu index="1">
            <template #title>
              <el-icon><User/></el-icon>
              <span>用户信息维护</span>
            </template>
            <el-menu-item index="/addUser">添加用户信息</el-menu-item>
            <el-menu-item index="/users">查询用户信息</el-menu-item>
          </el-sub-menu>
<!--          商品信息维护-->
<!--          <el-sub-menu index="2">-->
<!--            <template #title>-->
<!--              <el-icon><Goods/></el-icon>-->
<!--              <span>商品信息维护</span>-->
<!--            </template>-->
<!--            <el-menu-item index="/">添加商品信息</el-menu-item>-->
<!--            <el-menu-item index="/">查询商品信息</el-menu-item>-->
<!--          </el-sub-menu>-->
        </el-menu>
      </div>
      <div id="right">
        <router-view/>
      </div>
    </div>
    <div id="bottom">
      版权归个人所有
    </div>
  </div>
</template>

<script>
export default {
  name: "Main",
  data() {
    return {
      userName: ''
    }
  },
  created() {
    this.userName = this.$route.query.userName;
  },
  methods: {
    toIndex() {
      this.$router.push('/index');
    },
    exit() {
      this.$router.push('/login');
      this.$message.warning("退出登录")
    }
  }
}
</script>

<style scoped>
  #mainContainer {
    width: 100%;
    height: 100%;
    background-image: url("http://rpbz8r33e.hd-bkt.clouddn.com/default/15.jpg");
    background-repeat: no-repeat;
    background-size: 100% 100%;
    display: flex;
    flex-direction: column;
  }

  #top {
    width: 100%;
    height: 98px;
    border-bottom: 1px solid gray;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  #logo {
    margin-left: 60px;
    font-size: 50px;
    font-family: 楷体,serif;
    text-shadow: 5px 5px 5px gray;
  }

  #info {
    margin-right: 50px;
    font-size: 14px;
  }

  #info span {
    margin-right: 20px;
  }

  #bottom {
    width: 100%;
    height: 30px;
    /*border: 1px solid gray;*/
    font-size: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #d2aeae;
  }

  #center {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: row;
  }

  #left {
    width: 200px;
    height: 100%;
    border-right: 1px solid gray;
  }

  #right {
    flex: 1;
    height: 100%;
  }
</style>
